package com.java.jvm.demo.chapter02;

import org.junit.Test;

/**
 * @author wangning
 * @create 2021-10-20 20:47
 * 操作数栈代码
 * 使用javap -v 或者 javap -verbose可以查看
 */
public class OpreandStackTest {
	public static void main(String[] args) {
		byte i = 15;
		int j = 8;
		int k = i + j;

	}

	public int test() {
		int i = 1;
		int j = 2;
		return i + j;
	}

	/*
	 * 面试过程中，说一下i++与++i的区别
	 */
	@Test
	public void add() {
		//第一类
		int i1 = 10;
//		i1++;
		System.out.println(i1++);//10
		System.out.println("-------------------");

		int i2 = 10;
//		++i2;
		System.out.println(++i2);//11
		System.out.println("-------------------");

		//第二类
		int i3 = 10;
		int i4 = i3++;//10
		System.out.println(i4);
		System.out.println("-------------------");

		int i5 = 10;
		int i6 = ++i5;//11
		System.out.println(i6);
		System.out.println("-------------------");

		//第三类
		int i7 = 10;
		i7 = i7++;//10
		System.out.println(i7);
		System.out.println("-------------------");

		int i8 = 10;
		i8 = ++i8;//11
		System.out.println(i8);
		System.out.println("-------------------");

		//第四类
		int i9 = 10;
		int i10 = i9++ + ++i9;
		System.out.println("i10 = " + i10);//22
		System.out.println("-------------------");

		int i = 10;
		i = i++ + ++i;
		System.out.println("i = " + i);


	}
}
